home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWStream / Include / SLStrmRW.h < prev   
Encoding:
Text File  |  1996-04-25  |  6.6 KB  |  242 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLStrmRW.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9. #ifndef SLSTRMRW_H
  10. #define SLSTRMRW_H
  11.  
  12.  
  13. #ifndef FWODEXCE_H
  14. #include "FWODExce.h"
  15. #endif
  16.  
  17. #ifndef FWSOMENV_H
  18. #include "FWSOMEnv.h"
  19. #endif
  20.  
  21. // Export or Import functions for CFM-68K [sfu]
  22.  
  23. #if defined(FW_ODFLIB_IMPORT)
  24. #pragma import on
  25. #elif defined(FW_ODFLIB)
  26. #pragma export on
  27. #endif
  28.  
  29. FW_EXTERN_C_BEGIN
  30.  
  31. //========================================================================================
  32. // Forward class declarations
  33. //========================================================================================
  34.  
  35. class FW_OSink;
  36. class FW_OObjectRegistry;
  37.  
  38.  
  39. //========================================================================================
  40. //    STRUCT FW_SReadableStream
  41. //========================================================================================
  42.  
  43. struct FW_SReadableStream;
  44. typedef FW_SReadableStream* FW_HReadableStream;
  45. struct FW_SReadableStream
  46. {
  47.     FW_OSink*                        fSink;
  48.     FW_OObjectRegistry*                fObjectRegistry;
  49.     Environment                        fev;
  50.  
  51.     void*                            fReserved;
  52.  
  53.     int                                fNumberFormat;
  54.     FW_Boolean                        fArchiveCreatedObjectRegistry;
  55. };
  56.  
  57.  
  58.  
  59. //========================================================================================
  60. //    FW_SReadableStream Member Functions
  61. //========================================================================================
  62.  
  63.  
  64. FW_PlatformError    SL_API    
  65. FW_PrivReadableStream_Construct(FW_HReadableStream stream, 
  66.                                 FW_OSink* sink,
  67.                                 FW_OObjectRegistry* objectRegistry,
  68.                                 int numberFormat);
  69.         // Construct the instance.
  70.  
  71. FW_PlatformError    SL_API    
  72. FW_PrivReadableStream_CopyConstruct(FW_HReadableStream stream, 
  73.                                     FW_HReadableStream original);
  74.         // Construct the instance.
  75.  
  76. FW_PlatformError    SL_API    
  77. FW_PrivReadableStream_Destruct(FW_HReadableStream stream);
  78.         // Destruct the instance.
  79.  
  80. FW_PlatformError    SL_API    
  81. FW_PrivReadableStream_ReadBytes(FW_HReadableStream stream, 
  82.                                 void* buffer, 
  83.                                 long count);
  84.         // Read 'count' bytes into buffer.
  85.  
  86. FW_PlatformError    SL_API 
  87. FW_PrivReadableStream_ReadChars(FW_HReadableStream stream, 
  88.                                 char* buffer, 
  89.                                 long count);
  90.         // Read 'count' chars into buffer.
  91.  
  92. FW_PlatformError    SL_API 
  93. FW_PrivReadableStream_ReadNullTerminatedString(FW_HReadableStream stream, 
  94.                                                char* nullTerminatedString);
  95.         // Read a null-terminated string.
  96.         
  97. FW_PlatformError    SL_API 
  98. FW_PrivReadableStream_ReadShorts(FW_HReadableStream stream, 
  99.                                  short* buffer, 
  100.                                  long count);
  101.         // Read 'count' shorts into buffer.
  102.  
  103. FW_PlatformError    SL_API 
  104. FW_PrivReadableStream_ReadLongs(FW_HReadableStream stream, 
  105.                                 long* buffer, 
  106.                                 long count);
  107.         // Read 'count' longs into buffer.
  108.  
  109. FW_PlatformError    SL_API 
  110. FW_PrivReadableStream_ReadFloats(FW_HReadableStream stream, 
  111.                                  float* buffer, 
  112.                                  long count);
  113.         // Read 'count' floats into buffer.
  114.  
  115. FW_PlatformError    SL_API 
  116. FW_PrivReadableStream_ReadDoubles(FW_HReadableStream stream, 
  117.                                   double* buffer, 
  118.                                   long count);
  119.         // Read 'count' doubles into buffer.
  120.  
  121.  
  122. //----------------------------------------------------------------------------------------
  123. // FW_PrivReadableStream_ReadInts
  124. //----------------------------------------------------------------------------------------
  125.  
  126. inline FW_PlatformError FW_PrivReadableStream_ReadInts(FW_HReadableStream stream, 
  127.                                                        int* buffer, 
  128.                                                        long count)
  129. {
  130. #if FW_FOUR_BYTE_INTS
  131.     return FW_PrivReadableStream_ReadLongs(stream, (long*)buffer, count);
  132. #else
  133.     return FW_PrivReadableStream_ReadShorts(stream, (short*)buffer, count);
  134. #endif
  135. }
  136.  
  137.  
  138. //========================================================================================
  139. //    STRUCT FW_SWritableStream
  140. //========================================================================================
  141.  
  142. struct FW_SWritableStream;
  143. typedef FW_SWritableStream* FW_HWritableStream;
  144. struct FW_SWritableStream
  145. {
  146.     FW_OSink*                        fSink;
  147.     FW_OObjectRegistry*                fObjectRegistry;
  148.     Environment                        fev;
  149.  
  150.     void*                            fReserved;
  151.  
  152.     int                                fNumberFormat;
  153.     FW_Boolean                        fArchiveCreatedObjectRegistry;
  154. };
  155.  
  156.  
  157. FW_PlatformError    SL_API    
  158. FW_PrivWritableStream_Construct(FW_HWritableStream stream, 
  159.                                 FW_OSink* sink,
  160.                                 FW_OObjectRegistry* objectRegistry,
  161.                                 int numberFormat);
  162.         // Construct the instance.
  163.  
  164. FW_PlatformError    SL_API    
  165. FW_PrivWritableStream_CopyConstruct(FW_HWritableStream stream, 
  166.                                     FW_HWritableStream original);
  167.         // Construct the instance.
  168.  
  169. FW_PlatformError    SL_API    
  170. FW_PrivWritableStream_Destruct(FW_HWritableStream stream);
  171.         // Destruct the instance.
  172.  
  173. FW_PlatformError    SL_API 
  174. FW_PrivWritableStream_WriteBytes(FW_HWritableStream stream, 
  175.                                  const void* buffer, 
  176.                                  long count);
  177.         // Write 'count' bytes from buffer.
  178.  
  179. FW_PlatformError    SL_API 
  180. FW_PrivWritableStream_WriteChars(FW_HWritableStream stream, 
  181.                                  const char* buffer, 
  182.                                  long count);
  183.         // Write 'count' chars from buffer.
  184.  
  185. FW_PlatformError    SL_API 
  186. FW_PrivWritableStream_WriteNullTerminatedString(FW_HWritableStream stream, 
  187.                                                 const char* buffer);
  188.         // Write a null terminated string.
  189.  
  190. FW_PlatformError    SL_API 
  191. FW_PrivWritableStream_WriteShorts(FW_HWritableStream stream, 
  192.                                   const short* buffer, 
  193.                                   long count);
  194.         // Write 'count' shorts from buffer.
  195.  
  196. FW_PlatformError    SL_API 
  197. FW_PrivWritableStream_WriteLongs(FW_HWritableStream stream, 
  198.                                  const long* buffer, 
  199.                                  long count);
  200.         // Write 'count' longs from buffer.
  201.  
  202. FW_PlatformError    SL_API 
  203. FW_PrivWritableStream_WriteFloats(FW_HWritableStream stream, 
  204.                                   const float* buffer, 
  205.                                   long count);
  206.         // Write 'count' floats from buffer.
  207.  
  208. FW_PlatformError    SL_API 
  209. FW_PrivWritableStream_WriteDoubles(FW_HWritableStream stream, 
  210.                                    const double* buffer, 
  211.                                    long count);
  212.         // Write 'count' doubles from buffer.
  213.  
  214.  
  215. //----------------------------------------------------------------------------------------
  216. // FW_PrivWritableStream_WriteInts
  217. //----------------------------------------------------------------------------------------
  218.  
  219. inline FW_PlatformError FW_PrivWritableStream_WriteInts(FW_HWritableStream stream, 
  220.                                                         const int* buffer, 
  221.                                                         long count)
  222. {
  223. #if FW_FOUR_BYTE_INTS
  224.     return FW_PrivWritableStream_WriteLongs(stream, (const long*)buffer, count);
  225. #else
  226.     return FW_PrivWritableStream_WriteShorts(stream, (const short*)buffer, count);
  227. #endif
  228. }
  229.  
  230.  
  231. FW_EXTERN_C_END
  232.  
  233. // For CFM-68K [sfu]
  234.  
  235. #if defined(FW_ODFLIB_IMPORT)
  236. #pragma import off
  237. #elif defined(FW_ODFLIB)
  238. #pragma export off
  239. #endif
  240.  
  241. #endif
  242.